<template>
    <div class="logon">
        <Log text='注册' :sw='inputShow' :confirm='confirm'  @log='isLogon'>
          <p class="main-text">
              <router-link :to='{name: "Login"}' class="router">
              <span>已有账号去登陆</span>
              </router-link>
              </p>
      </Log>
    </div>
</template>

<style lang="scss" scoped>
@import '../../assets/style/public.scss';
  .logon{
      width: 100%;
      height: 100%;
  }
  .main-text{
    margin: 0;
    font-size: .14rem;
    color: $log-color;
    .router{
        color: $log-color;
    }
}
</style>

<script>
import { useRouter } from 'vue-router'
import Log, { userLoginEffect } from '../../components/log/log.vue'
export default {
  name: 'Logon',
  components: {
    Log
  },
  setup () {
    const inputShow = true
    const confirm = false
    const router = useRouter()
    const isLogon = userLoginEffect(
      'https://www.fastmock.site/mock/ae8e9031947a302fed5f92425995aa19/jd/api/user/register',
      () => {
        setTimeout(() => {
          router.push({ name: 'Login' })
        }, 2000)
      },
      '注册失败',
      true
    )
    return { inputShow, confirm, isLogon }
  }
}
</script>
